
**********************************************************************************
* Article: Status at the Margins: Why Paraguay Recognizes Taiwan and Shuns China
* Journal: Foreign Policy Analysis
* Year: 2020
* Authors: Long, T. & Urdinez. F.
**********************************************************************************


*A. REPLICATION OF TABLES IN THE BODY OF THE PAPER 

**1. Figure 1 - Diplomatic de-recognition in Latin America. 
* Figure 1 was not created using Stata. Yet, you can replicate it using the following commands

set more off
use "C:\...\fig1.dta", clear

ssc install blindschemes
twoway connected remaining year, xline(1971) scheme(plottig)


**2. Table 1 - Estimation of the opportunity cost of diplomatic relations with Taiwan in LAC

set more off
use "C:\...\taiwan_cost.dta", clear

xtset cowcode year 

xtreg fdi_log   i.taiwan  i.year  if year>=2005 & year <=2017 & region_code==3, re r
estimates store m1b

xtreg fdi_log  i.taiwan log_gdp dt_dod_dect_gn_zs  ny_gdp_ngas_rt_zs ny_gdp_petr_rt_zs nv_agr_totl_zs ny_gdp_minr_rt_zs  log_gdp_pc  bx_klt_dinv_wd_gd_zs v2x_corr i.year  if year>2005 & year <2017 & region_code==3, re r
estimates store m2b

xtreg aid_log   i.taiwan i.year  if year>=2005 & year <=2017 & region_code==3, re r
estimates store m3b

xtreg aid_log  i.taiwan log_gdp dt_dod_dect_gn_zs  ny_gdp_ngas_rt_zs ny_gdp_petr_rt_zs nv_agr_totl_zs ny_gdp_minr_rt_zs  log_gdp_pc  bx_klt_dinv_wd_gd_zs v2x_corr ib2016.year  if year>2005 & year <2017 & region_code==3, re r
estimates store m4b

xtreg finance_log  i.taiwan i.year  if year>=2005 & year <=2014 & region_code==3,  re r
estimates store m5b

xtreg finance_log   i.taiwan log_gdp dt_dod_dect_gn_zs  ny_gdp_ngas_rt_zs ny_gdp_petr_rt_zs nv_agr_totl_zs ny_gdp_minr_rt_zs  log_gdp_pc  bx_klt_dinv_wd_gd_zs v2x_corr i.year  if year>2005 & year <=2014 & region_code==3, re r
estimates store m6b

esttab m1b m2b m3b m4b m5b m6b , r2 se

***3. Interpretation of findings (footnotes 20 and 21)

***3.1. Percentage change in FDI from Taiwan to PRC (Model 2)
di 100*[exp(2.092) - 1] 
*(7 times larger)

***3.2. Percentage change in finance from Taiwan to PRC (Model 6)
di 100*[exp(4.814) - 1] 
*(122 times larger)

**4. Table 2 - summary data for Latin America (these commands were used to build Table 2)

set more off
use "C:\...\taiwan_cost.dta", clear

tabstat fdi aid finance  weight_aid_finance_fdi if region_code==3, by(country)
tabstat fdi aid finance  weight_aid_finance_fdi if region_code==3, by(taiwan)



*B. REPLICATION OF TABLES IN THE ONLINE APPENDIX

** Tables A and B were not created using Stata.

**Table C -  Descriptive statistics for control variables in baseline model

set more off
use "C:\...\taiwan_cost.dta", clear

sum log_gdp dt_dod_dect_gn_zs  ny_gdp_ngas_rt_zs ny_gdp_petr_rt_zs nv_agr_totl_zs ny_gdp_minr_rt_zs  log_gdp_pc  bx_klt_dinv_wd_gd_zs v2x_corr  if year>2005 & year <2017 

**Table D - correlation matrix of covariates

set more off
use "C:\...\taiwan_cost.dta", clear

pwcorr log_gdp dt_dod_dect_gn_zs  ny_gdp_ngas_rt_zs ny_gdp_petr_rt_zs nv_agr_totl_zs ny_gdp_minr_rt_zs  log_gdp_pc  bx_klt_dinv_wd_gd_zs v2x_corr  if year>2005 & year <2017 

**Table E - Estimation of the opportunity cost of diplomatic relations with Taiwan in World Sample 

set more off
use "C:\...\taiwan_cost.dta", clear

xtset cowcode year 

xtreg fdi_log   i.taiwan  i.year  if year>=2005 & year <=2017 , re r
estimates store m1w

xtreg fdi_log  i.taiwan log_gdp dt_dod_dect_gn_zs  ny_gdp_ngas_rt_zs ny_gdp_petr_rt_zs nv_agr_totl_zs ny_gdp_minr_rt_zs  log_gdp_pc  bx_klt_dinv_wd_gd_zs v2x_corr i.year  if year>2005 & year <2017 , re r
estimates store m2w

xtreg aid_log   i.taiwan i.year  if year>=2005 & year <=2017 , re r
estimates store m3w

xtreg aid_log  i.taiwan log_gdp dt_dod_dect_gn_zs  ny_gdp_ngas_rt_zs ny_gdp_petr_rt_zs nv_agr_totl_zs ny_gdp_minr_rt_zs  log_gdp_pc  bx_klt_dinv_wd_gd_zs v2x_corr i.year  if year>2005 & year <2017 , re r
estimates store m4w

xtreg finance_log  i.taiwan i.year  if year>=2005 & year <=2014,  re r
estimates store m5w

xtreg finance_log   i.taiwan log_gdp dt_dod_dect_gn_zs  ny_gdp_ngas_rt_zs ny_gdp_petr_rt_zs nv_agr_totl_zs ny_gdp_minr_rt_zs  log_gdp_pc  bx_klt_dinv_wd_gd_zs v2x_corr i.year  if year>2005 & year <=2014, re r
estimates store m6w

esttab m1w m2w m3w m4w m5w m6w , pr2 se

**Table F - Replication of Table 1 using PCSE, lagged dependent variables and AR1 structure (Robustness check) 

set more off
use "C:\...\taiwan_cost.dta", clear

xtset cowcode year 


xtpcse fdi_log  l.fdi_log i.taiwan   if year>=2005 & year <=2017 & region_code==3, p c(a) het
estimates store m1b2

xtpcse fdi_log l.fdi_log i.taiwan log_gdp dt_dod_dect_gn_zs  ny_gdp_ngas_rt_zs ny_gdp_petr_rt_zs nv_agr_totl_zs ny_gdp_minr_rt_zs  log_gdp_pc  bx_klt_dinv_wd_gd_zs v2x_corr   if year>2005 & year <2017 & region_code==3, p c(a) het
estimates store m2b2

xtpcse aid_log  l.aid_log i.taiwan   if year>=2005 & year <=2017 & region_code==3, p c(a) het
estimates store m3b2

xtpcse aid_log l.aid_log  i.taiwan log_gdp dt_dod_dect_gn_zs  ny_gdp_ngas_rt_zs ny_gdp_petr_rt_zs nv_agr_totl_zs ny_gdp_minr_rt_zs  log_gdp_pc  bx_klt_dinv_wd_gd_zs v2x_corr   if year>2005 & year <2017 & region_code==3, c c(a) het
estimates store m4b2

xtpcse finance_log l.finance_log i.taiwan   if year>=2005 & year <=2014 & region_code==3,  p c(a) het
estimates store m5b2

xtpcse finance_log l.finance_log  i.taiwan log_gdp dt_dod_dect_gn_zs  ny_gdp_ngas_rt_zs ny_gdp_petr_rt_zs nv_agr_totl_zs ny_gdp_minr_rt_zs  log_gdp_pc  bx_klt_dinv_wd_gd_zs v2x_corr   if year>2005 & year <=2014 & region_code==3, p c(a) het
estimates store m6b2

esttab m1b2 m2b2 m3b2 m4b2 m5b2 m6b2 , pr2 se  star(+ 0.101 * 0.05 ** 0.01 *** 0.001 )


**Not reported in the appendix -  

***1.Unit Root Tests of dependent variables 

*** 1 lag
xtunitroot fisher fdi, dfuller l(1)
xtunitroot fisher aid, dfuller l(1)
xtunitroot fisher finance, dfuller l(1)
*** 2 lags
xtunitroot fisher fdi, dfuller l(2)
xtunitroot fisher aid, dfuller l(2)
xtunitroot fisher finance, dfuller l(2)

**2. VIF for models in Table 1

*2.1. Model 1. Average VIF: 1.78
reg fdi_log   i.taiwan  i.year  if year>=2005 & year <=2017 & region_code==3,  r
vif
*2.2. Model 2. Average VIF: 2.7
reg fdi_log  i.taiwan log_gdp dt_dod_dect_gn_zs  ny_gdp_ngas_rt_zs ny_gdp_petr_rt_zs nv_agr_totl_zs ny_gdp_minr_rt_zs  log_gdp_pc  bx_klt_dinv_wd_gd_zs v2x_corr i.year  if year>2005 & year <2017 & region_code==3, r
vif
*2.3. Model 3. Average VIF: 1.78
reg aid_log   i.taiwan i.year  if year>=2005 & year <=2017 & region_code==3,  r
vif

*2.4. Model 4. Average VIF: 2.7
reg aid_log  i.taiwan log_gdp dt_dod_dect_gn_zs  ny_gdp_ngas_rt_zs ny_gdp_petr_rt_zs nv_agr_totl_zs ny_gdp_minr_rt_zs  log_gdp_pc  bx_klt_dinv_wd_gd_zs v2x_corr i.year  if year>2005 & year <2017 & region_code==3,  r
vif

*2.5 Model 5. Average VIF: 1.81
reg finance_log  i.taiwan i.year  if year>=2005 & year <=2014 & region_code==3,   r
vif

*2.6. Model 6. Average VIF: 2.9
reg finance_log   i.taiwan log_gdp dt_dod_dect_gn_zs  ny_gdp_ngas_rt_zs ny_gdp_petr_rt_zs nv_agr_totl_zs ny_gdp_minr_rt_zs  log_gdp_pc  bx_klt_dinv_wd_gd_zs v2x_corr i.year  if year>2005 & year <=2014 & region_code==3,  r
vif



